<!DOCTYPE html>
<html lang="en">
<head>
    {include file="common/meta_new" /}
</head>
<body class="F6">

<script src="/static/js/layer/layer.js"></script>
<script>
        
        function submitPay(){
            var payType =  2;
            var payMoney =  $("#withdrawMoney").val();
            var bankNum =  $("#bankNum").val();
            var bankName =  $("#bankName").val();
            var userName =  $("#userName").val();
            if(payMoney<=0){
                layer.msg('提现金额必须大于 0');
                return;
            }
            if(payType!=0 && payType!=1 && payType!=2){
                layer.msg('请选择收款方式');
                return;
            }
            
            if(payType==2){
                if(userName==''){
                    layer.msg('请输入真实姓名！');
                    return;
                }
                if(bankName==''){
                    layer.msg('请输入银行名称！');
                    return;
                }
                if(bankNum==''){
                    layer.msg('请输入银行卡号！');
                    return;
                }
            }
            
            $.post("{:url('index/user/payType')}",{"payType":payType,"payMoney":payMoney,"bankNum":bankNum,"bankName":bankName,"userName":userName,"callback":"{$callback}"},function(res){    
//                console.log(res);
                layer.msg(res.msg,{icon:1,time:3000,shade:0.4},function() {
//                    console.log(res.url);
                    location.href=res.url;
                });
            },"json");
            
        }
        
</script>

<div id="app" class="withdrawal-page">
    <!-- header -->
    <div class="header">
        <div class="header-height"></div>
        <div class="header-wrap">
            <div class="header-content">
                <div class="left">
                    <a href="{:url('index/user/index');}"><div class="go-back"><img src="/static/images/go-back.png" alt=""></div></a>
                    <div  class="text">收款设置</div>
                </div>
                <div class="title"></div>
            </div>
        </div>
    </div>
    <div class="top-wrap" style="height: 5.6rem">
        <div class="title">银行卡信息</div>
        <div class="amount-box">
            <div class="symbol">B:</div>
            <input id="bankName"  type="text" value="{$user['bank_name']}" placeholder="请输入银行名称">            
        </div>
        <div class="amount-box">
            <div class="symbol">R:</div>
            <input id="userName" type="text" value="{$user['user_name']}" placeholder="请输入真实姓名">            
        </div>
        <div class="amount-box">
            <div class="symbol">No:</div>
            <input id="bankNum" type="text" value="{$user['card_num']}" placeholder="请输入银行卡号">            
        </div>
    </div>
    <div class="payway-wrap">
        <div class="title">到账方式</div>
        <div id="tab" class="list">
<!--            <div class="item active" onclick="switchTab(this,0)" >
                <div class="image">
                    <img src="/static/images/WeChat.png" alt="">
                </div>
                <div class="text">微信</div>
                <img class="sel-img" src="/static/images/selected.png" alt="">
            </div>
            <div class="item" onclick="switchTab(this,1)" >
                <div class="image">
                    <img src="/static/images/zfb.png" alt="">
                </div>
                <div class="text">支付宝</div>
                <img class="sel-img" src="/static/images/selected.png" alt="">
            </div>-->
            <div class="item active" >
                <div class="image">
                    <img src="/static/images/UnionPay.png" alt="">
                </div>
                <div class="text">银行卡</div>
                <img class="sel-img" src="/static/images/selected.png" alt="">
            </div>
        </div>
    </div>
    <div class="bottom-btn" onclick="submitPay()">保存</div>
</div>
<script src="/static/js/common.js"></script>
</body>
</html>